package sanrenxing.dayEnd.backRepertoryTotal.controller;


import org.springframework.web.bind.annotation.*;
import sanrenxing.dayEnd.backRepertoryTotal.domain.Days;
import sanrenxing.dayEnd.backRepertoryTotal.service.DaysBiz;
import sanrenxing.dayEnd.backRepertoryTotal.utils.sdf;

import javax.annotation.Resource;
import java.text.ParseException;
import java.util.List;

@RestController
@RequestMapping("/dy")
public class DaysController {
    @Resource
    private DaysBiz daysIm;
    @Resource
    private sdf ss;
    @GetMapping("/da")
    public List<Days> lt() throws ParseException {
        /*System.out.println(ss.sds("2021-9-30", 1));*/
        return daysIm.all();
    }
    @PutMapping("/das")
    public String lts(@RequestBody Days dy) throws ParseException {
        /*System.out.println(dy.getEnddate());*/
        return daysIm.add(dy)>0?"cg":"sb";
    }
    @DeleteMapping("/da/{ss}")
    public String del(@PathVariable("ss") int  dy){
        return daysIm.del(dy)>0?"cg":"sb";
    }
}
